package com.chenjian.designpattern.factory;

public class ComputerFactory {

    public static Computer createComputer(String type) {

        Computer computer = null;

        switch (type) {
            default:
                computer = new Computer() {
                    @Override
                    public void start() {
                        System.out.println("杂牌货");
                    }
                };
                break;
            case "lx":
                computer = new LxComputer();
                break;
            case "hp":
                computer = new HpComputer();
                break;
        }
        return computer;

    }
}
